
<%@ page import="sige.Pagamento" %>
<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'pagamento.label', default: 'Pagamento')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
	</head>
	<body>
		<center>
        	<h1><g:message code="default.list.label" args="[entityName]" /></h1>
        </center>
        <ul class="breadcrumb">
          <li>
            <a class="home" href="${createLink(uri: '/')}">
              <i class="icon-home"></i>
              <g:message code="default.home.label"/>
            </a>
            <span class="divider"><g:message code="span.divider" /></span>
          </li>
          
        </ul>
        <g:if test="${flash.message}">
          <div class="alert alert-info">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            ${flash.message}
          </div>
        </g:if>
        <g:form class="form-inline well span12" action="porData">
          <div class="form-group">
            <label class="sr-only" for="propriedade">Buscar Por:</label>
            <g:select optionKey="id" optionValue="title"
                name="propriedade" 
                from="${[['id':'dataDeVencimento', 'title':'Data de Vencimento'],['id':'dataDePagamento', 'title':'Data de Pagamento']]}" 
                />
                
            <label class="sr-only" for="inicio">entre</label>
            <g:field type="date" name="inicio" value="${new Date()}"/>
          
            <label class="sr-only" for="fim">e</label>
            <g:field type="date" name="fim" value="${new Date()}"/>
            
            <button type="submit" class="btn btn-primary">
                <i class="icon-search icon-white"></i>
            </button>
          </div>
          
        </g:form>
        
		<div id="list-pagamento" class="span9" role="main">
			<table class="table table-striped table-hover">
				<thead>
					<tr>
					    
					    <g:sortableColumn property="dataDeVencimento" title="${message(code: 'pagamento.dataDeVencimento.label', default: 'Data De Vencimento')}" />
					
						<g:sortableColumn property="valor" title="${message(code: 'pagamento.valor.label', default: 'Valor')}" />
					
						<th><g:message code="pagamento.caixaDiario.label" default="Caixa Diario" /></th>
					
						<g:sortableColumn property="total" title="${message(code: 'pagamento.total.label', default: 'Total')}" />
					
					    <th><g:message code="pagamento.pago.label" default="Pago" /></th>
					</tr>
				</thead>
				<tbody>
				<g:each in="${pagamentoInstanceList}" status="i" var="pagamentoInstance">
					<tr >
					
						<td>
						    <g:link action="show" id="${pagamentoInstance.id}">
						        <g:formatDate date="${pagamentoInstance.dataDeVencimento}" />
						    </g:link>
						</td>
					
						<td>
						    <g:formatNumber number="${pagamentoInstance?.valor}" type="currency" currencyCode="BRL" />
						</td>
					
						<td>${fieldValue(bean: pagamentoInstance, field: "caixaDiario")}</td>
					
						<td>
						    <g:formatNumber number="${pagamentoInstance?.total}" type="currency" currencyCode="BRL" />
						</td>
						
						<td>
                            <g:if test="${pagamentoInstance?.pago}">
                              <span class="label label-success">
                                ${message(code: 'default.boolean.true', default: 'Sim')}
                              </span>
                            </g:if>
                            <g:else>
                              <span class="label label-important">
                                ${message(code: 'default.boolean.false', default: 'Sim')}
                              </span>
                            </g:else>
                          </td>
					
					</tr>
				</g:each>
				</tbody>
			</table>
			
			<div align="center">
			    <g:paginate action="list" total="${pagamentoInstanceTotal}" />
			</div>
		</div>
	</body>
</html>
